跳至主要内容

Quick Start

Installation

Install Docker

https://docs.docker.com/engine/install/

Show version

docker --version

Untitled

Check image

docker images

Untitled

第一次安裝 Docker 只會看到最上方 REPOSITORY TAG IMAGE ID CREATED SIZE 這排

Quick start

Download image

  • DockerHub

    https://hub.docker.com

  • Search Python

    Search 3.12-slim-bullseye

    Untitled

  • Download Docker image

    docker pull python:3.12-slim-bullseye
  • 查看 Docker image

    docker images

    Untitled

    A new python repository appears, and it has a tag 3.12-slim-bullseye

Manipulate container

  • Check running container

    docker ps

    Untitled

    Before starting the container, you will only see the row at the top showing CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

  • Start a container

    docker run -it -d --name docker-tutorial python:3.12-slim-bullseye /bin/bash

    Untitled

  • Check running container again

    docker ps

    Untitled

  • Enter container

    docker exec -it docker-tutorial /bin/bash

    Untitled

    Cursor in terminal changed.